package com.slz3.business.module.drawManagement.draUserNumber.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.drawManagement.draUserNumber.domain.DraUserNumber;
import com.slz3.business.module.drawManagement.draUserNumber.domain.DraUserNumberFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class DraUserNumberTransactionalServiceImpl implements DraUserNumberTransactionalService {

    @Override
    public DraUserNumber modify(DraUserNumber draUserNumberNew) {
        Repositorys.draUserNumber.test();
        Repositorys.draUserNumber.save(DraUserNumberFactory.initBaseFields());
        System.err.println(1/0);
        draUserNumberNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.draUserNumber.saveAndFlush(draUserNumberNew);
    }

    @Override
    public List<DraUserNumber> batchModify(List<DraUserNumber> draUserNumberList) {
        return Repositorys.draUserNumber.saveAll(draUserNumberList);
    }
}
